/*
 * FILE utils.h
 * DESC tool functions
 */
#ifndef __UTILS_H__
#define __UTILS_H__

#include "config.h"

/*
 * First, we must have some lib-functions. Due to having no promises
 * glibc or other std-library available, we build another version. Thus
 * we can use the glibc version provided by BSP or ourself version.
 * 
 */
#define __LITE_BO_UNKNOWN__     0
#define __LITE_BO_MSB__         1
#define __LITE_BO_LSB__         2

#define LITE_MAXOF(A, B) ((A)>(B)?(A):(B))
#define LITE_MINOF(A, B) ((A)>(B)?(B):(A))

/*
 * FUNC _lite_memcpy
 * DESC Copy len bytes data from src to dst 
 */

INT32 _lite_memcpy(PVOID dst, PVOID src, INT32 len);

/*
 * FUNC _lite_strlen
 * DESC count the charachtes of a C string
 */

INT32 _lite_strlen(INT8 * str);

/*
 * FUNC _lite_strcpy
 * DESC copy a null-terminated C string from src to dst
 */

INT32 _lite_strcpy(INT8 * dst, INT8 * src);

/*
 * FUNC _lite_strncpy
 * DESC copy a C string witch length as most as len
 */

INT32 _lite_strncpy(INT8 * dst, INT8 * src, INT32 len);

/*
 * FUNC _lite_htol
 * DESC transform host 4-byte data hostlong from host
 * byte order to network byte order
 */

UINT32 _lite_htonl(UINT32 hostlong);

/*
 * FUNC _lite_htons
 * DESC transform host 2-byte data hostshort from host
 * byte order to network byte order;
 */

UINT16 _lite_htons(UINT16 hostshort);

/*
 * FUNC _lite_ntohl
 * DESC transform network 4-byte data netlong from network
 * byte order to host byte order
 */

UINT32 _lite_ntohl(UINT32 netlong);

/*
 * FUNC _lite_ntohs
 * DESC transfrom network 2-byte data netshort from network
 * byte order to host byte order
 */

UINT16 _lite_ntohs(UINT16 netshort);

#define ERR_PARM    -1
#define RET_OK       0

#endif /* __UTILS_H__*/
